package capstone.tagit;

import java.util.Comparator;
import java.util.Date;

/**
 * 
 * A comparison between two tags.  Included to improve modularity.
 * Likely to be used for sorting/filtering tags.
 * Currently sorted by date.
 *
 */
public class TagComparator implements Comparator<Tag> {

	@Override
	/**
	 * @param tag0 The first tag to compare
	 * @param tag1 The second tag to compare
	 * @return 0 if the dates are the same, <0 if tag0's date is newer than tag1's, >0 if tag0's date is older than tag1's 
	 */
	public int compare(Tag tag0, Tag tag1) {
		Date d0 = tag0.getDate();
		Date d1 = tag1.getDate();
		return d1.compareTo(d0);
	}
}
